﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using static Baci.ArcGIS._3DAnalystTools._Visibility.SunShadowFrequency;

namespace Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes
{
    public class GPEnumValueAttribute : Attribute
    {
        public string Value { get; set; }
        public GPEnumValueAttribute(string value) { Value = value; }

    }
    public static partial class Extension
    {
        public static string GetGPValue(this Enum enum4gp)
        {
            Type type = enum4gp.GetType();
            FieldInfo fd = type.GetField(enum4gp.ToString());
            if (fd == null)
                return string.Empty;
            object[] attrs = fd.GetCustomAttributes(typeof(GPEnumValueAttribute), false);
            string name = string.Empty;
            foreach (GPEnumValueAttribute attr in attrs)
            {
                name = attr.Value;
            }
            return name;

           

        }
    }


}
